<template>
  <el-container class="lay-container" :style="{ marginLeft: marginLeft }">
    <common-aside @updateCollapse="updateCollapse" />
    <el-container>
      <el-header class="el-header">
        <common-header />
        <common-tag />
      </el-header>
      <el-main class="right-main">
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script setup lang="ts">
  import { ref } from "vue";
  import CommonHeader from "../components/CommonHeader.vue";
  import CommonAside from "../components/CommonAside.vue";

  const marginLeft = ref("8%");

  // 处理菜单折叠状态的更新
  const updateCollapse = (isCollapse: boolean) => {
    marginLeft.value = isCollapse ? "4%" : "8%";
  };
</script>

<style scoped lang="less">
  .lay-container {
    margin-left: 8%; // 确保内容不被固定的菜单栏遮挡
    height: 100vh;
    // overflow-y: auto; // 支持内容滚动

    .el-header {
      background-color: #333;
      // margin-bottom: 50px;
    }
  }
</style>
